package cn.tedu.hhmc.sign.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import cn.tedu.hhmc.base.response.JsonResult;
import cn.tedu.hhmc.sign.pojo.dto.SignedContractInfoDTO;
import cn.tedu.hhmc.sign.pojo.dto.SignedContractInfoParam;
import cn.tedu.hhmc.sign.pojo.entity.SignedContractInfo;
import cn.tedu.hhmc.sign.pojo.vo.SignedContractInfoVO;
import cn.tedu.hhmc.sign.service.ISignedContractInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 待处理服务项目信息Controller
 * 
 * @author ruoyi
 * @date 2024-12-05
 */
@Slf4j
@RestController
@RequestMapping("/hhmc/sign")
public class SignedContractInfoController
{
    @Autowired
    private ISignedContractInfoService signedContractInfoService;

    /**
     * 查询所有待处理服务项目信息列表
     */
    @GetMapping("/list")
    public JsonResult list()
    {
        List<SignedContractInfoVO> list = signedContractInfoService.selectSignedContractInfoList(new SignedContractInfoDTO());
        return JsonResult.ok(list);
    }

    /**
     * 查询待处理签约列表
     */
    @GetMapping("/select")
    public JsonResult select(SignedContractInfoDTO signedContractInfoDTO)
    {
        log.debug("查询待处理签约列表,参数:{}",signedContractInfoDTO);
        List<SignedContractInfoVO> list = signedContractInfoService.selectSignedContractInfoList(signedContractInfoDTO);
        return JsonResult.ok(list);
    }

    /**
     * 获取待处理服务项目信息详细信息
     */
    @GetMapping(value = "/select/{id}")
    public JsonResult selectById(@PathVariable("id") Long id)
    {
        return JsonResult.ok(signedContractInfoService.selectSignedContractInfoById(id));
    }

    /**
     * 新增待处理服务项目信息
     */
    @PostMapping("/insert")
    public JsonResult insert(@RequestBody SignedContractInfo signedContractInfo)
    {
        signedContractInfoService.insertSignedContractInfo(signedContractInfo);
        return JsonResult.ok();
    }

    /**
     * 修改待处理服务项目信息
     */
    @PostMapping("/update")
    public JsonResult update(SignedContractInfoParam signedContractInfoParam)
    {
        log.debug("更新签约列表的状态,参数:{}",signedContractInfoParam);
        return  JsonResult.ok(signedContractInfoService.updateSignedContractInfo(signedContractInfoParam));
    }

    /**
     * 删除待处理服务项目信息
     */
	@DeleteMapping("/{ids}")
    public JsonResult remove(@PathVariable Long[] ids)
    {
        signedContractInfoService.deleteSignedContractInfoByIds(ids);
        return JsonResult.ok();
    }
}
